package com.niiwoo.civet.scheduler.trigger;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.niiwoo.civet.trade.service.creditor.CreditorSaleOrderDubboService;

import lombok.extern.slf4j.Slf4j;

/**
 * 债权出让相关的JOB服务
 *  
 * @author kevin.jia
 * @create 2018年7月6日 下午3:32:57
 */
@Slf4j
@Component
public class CreditorSaleJobTrigger {
	
    @Reference(version = "1.0.0")
    private CreditorSaleOrderDubboService creditorSaleOrderDubboService;
    
    @Scheduled(cron = "${creditorsale.cancel-creditor-sale-order}")
    public void autoCancelCreditorSaleOrder(){
        log.info("==========autoCancelCreditorSaleOrder invoke start ==========");
        creditorSaleOrderDubboService.autoCancelCreditorSale();
        log.info("==========autoCancelCreditorSaleOrder invoke end==========");
    }
    
    @Scheduled(cron = "${creditorsale.debenture_sale_compensation}")
    public void debentureSaleCompensation(){
        log.info("==========debentureSaleCompensation invoke start ==========");
        creditorSaleOrderDubboService.debentureSaleCompensation();
        log.info("==========debentureSaleCompensation invoke end==========");
    }
    
    @Scheduled(cron = "${creditorsale.cancel_debenture_sale_compensation}")
    public void cancelDebentureSaleCompensation(){
        log.info("==========debentureSaleCompensation invoke start ==========");
        creditorSaleOrderDubboService.cancelDebentureSaleCompensation();
        log.info("==========debentureSaleCompensation invoke end==========");
    }
    
	@Scheduled(cron = "${creditorsale.delete-sellout-creditor-order}")
	public void deleteSelloutCreditorOrder() {
		log.info("==========debentureSaleCompensation invoke start ==========");
		creditorSaleOrderDubboService.deleteSelloutCreditorOrder();
		log.info("==========debentureSaleCompensation invoke end==========");
	}
}